package com.dha.status;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

public class NetworkStatus {
	private Context context;

	public NetworkStatus(Context context) {
		super();
		this.context = context;
	}
	
	public boolean isConnected(){
		ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
		if(cm!=null){
			NetworkInfo[] ni = cm.getAllNetworkInfo();
			if (ni != null){
				for (int i =0; i< ni.length; i++){
					if (ni[i].getState() == NetworkInfo.State.CONNECTED){
						return true;
					}
				}
			}
		}
		return false;
	}
}
